﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using Microsoft.Synchronization.Data.SqlServer;
using Microsoft.Synchronization.Data;

namespace HATX_Provision
{
    class Program
    {
        [STAThread]
        static void Main(string[] args)
        {
            //string sqlConnectionString = @"Data Source=COMPAQ420; Initial Catalog=KEEPER_R11X_TXHA_SV; User Id=sa;Password=nothing;MultipleActiveResultSets=true;";
            //string sqlConnectionString2 = @"Data Source=COMPAQ420; Initial Catalog=KEEPER_R11X_TXHA; User Id=sa;Password=nothing;MultipleActiveResultSets=true;";
            //SqlConnection conn = new SqlConnection(sqlConnectionString);
            //SqlConnection conn2 = new SqlConnection(sqlConnectionString2);

            //string[] arrDanhMuc = new string[] { "DmTuyen", "PhanTram", "DkThuong", "DmGiaXang", "DmGara", "DmLoaiHd", "DmLoaiGt", "DmCx", "DmNhKh", "DmKh", "KhenThuongLx", "TBTuyen", "PsNo", "TraNo", "NhienLieu", "LxViPham" };
            //string[] arrPhieu = new string[] {"Dmxe","Dmkx", "DmBp","DmKmCn","NghiemThu"};
            ////arrPhieu = new string[] { };
            ////arrDanhMuc = new string[] { };

            //foreach (string node in arrDanhMuc)
            //{
               
            //    DbSyncScopeDescription nodeDes = new DbSyncScopeDescription(node + "Scope");
            //    DbSyncTableDescription tableDes = SqlSyncDescriptionBuilder.GetDescriptionForTable(node, conn);
            //    nodeDes.Tables.Add(tableDes);
            //    SqlSyncScopeProvisioning provi = new SqlSyncScopeProvisioning(conn2, nodeDes);
            //    provi.ObjectSchema = "Sync";
            //    provi.Apply();
            //}
            //foreach (string node in arrPhieu)
            //{

            //    DbSyncScopeDescription nodeDes = new DbSyncScopeDescription(node + "Scope");
            //    DbSyncTableDescription tableDes = SqlSyncDescriptionBuilder.GetDescriptionForTable(node, conn);
            //    nodeDes.Tables.Add(tableDes);
            //    SqlSyncScopeProvisioning provi = new SqlSyncScopeProvisioning(conn2, nodeDes);
            //    provi.ObjectSchema = "Sync";
            //    provi.Apply();
            //}

            //Console.Write("Finish");

            new ProvisionUltils().ShowDialog();
        }
    }
}
